package com.hex.ds.hdrs.cron.service;

import com.hex.ds.hdrs.cron.po.CronTaskDef;
import lombok.extern.slf4j.Slf4j;

/**
 * @author zgc
 * @date 2021-01-07
 */
@Slf4j
public class CronExec implements Runnable {

	private CronTaskDef cronTaskDef;

	private CronService cronService;

	public CronExec(CronTaskDef cronTaskDef, CronService cronService) {
		this.cronTaskDef = cronTaskDef;
		this.cronService = cronService;
	}

	@Override
	public void run() {
		log.info("【正在执行定时任务】任务PkId:{}" , cronTaskDef.getPkId());
		String res = cronService.taskExec(cronTaskDef);
		log.info("【执行定时结束】执行结果:{}" , res);
	}
}
